<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>电商管理后台系统</title>
    <link rel="stylesheet" href="assets/css/style.css">
    <style>
        .content {
            flex: 1;
            padding: 20px;
            margin-left: 240px;
            transition: margin-left 0.3s ease;
        }
        .content.sidebar-closed {
            margin-left: 60px;
        }
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid #e0e0e0;
        }
        .header h1 {
            font-size: 28px;
            font-weight: 600;
            color: #1a202c;
        }
        .header-actions {
            display: flex;
            align-items: center;
            gap: 15px;
        }
        .search-box {
            position: relative;
        }
        .search-box input {
            padding: 10px 15px 10px 40px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            font-size: 14px;
            width: 300px;
            transition: all 0.3s ease;
        }
        .search-box input:focus {
            outline: none;
            border-color: #4a6cf7;
            box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
        }
        .search-box i {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
        }
        .user-profile {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 15px;
            border-radius: 8px;
            background: white;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .user-profile:hover {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }
        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: linear-gradient(135deg, #4a6cf7, #7b93ff);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 500;
            font-size: 14px;
        }
        .user-info {
            display: flex;
            flex-direction: column;
        }
        .user-name {
            font-size: 14px;
            font-weight: 500;
            color: #333;
        }
        .user-role {
            font-size: 12px;
            color: #999;
        }
        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }
        .btn-primary {
            background: #4a6cf7;
            color: white;
        }
        .btn-primary:hover {
            background: #3a5ae8;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
        }
        .btn-secondary {
            background: white;
            color: #333;
            border: 1px solid #e0e0e0;
        }
        .btn-secondary:hover {
            background: #f5f5f5;
            border-color: #d0d0d0;
        }
        .card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            padding: 24px;
            margin-bottom: 20px;
            transition: all 0.3s ease;
        }
        .card:hover {
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
        }
        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        .card-title {
            font-size: 18px;
            font-weight: 600;
            color: #1a202c;
        }
        .grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }
        .stats-card {
            background: white;
            border-radius: 12px;
            padding: 24px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
        }
        .stats-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
        }
        .stats-card .icon {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            margin-bottom: 15px;
        }
        .stats-card .icon.primary {
            background: rgba(74, 108, 247, 0.1);
            color: #4a6cf7;
        }
        .stats-card .icon.success {
            background: rgba(46, 204, 113, 0.1);
            color: #2ecc71;
        }
        .stats-card .icon.warning {
            background: rgba(241, 196, 15, 0.1);
            color: #f1c40f;
        }
        .stats-card .icon.danger {
            background: rgba(231, 76, 60, 0.1);
            color: #e74c3c;
        }
        .stats-card .value {
            font-size: 32px;
            font-weight: 700;
            color: #1a202c;
            margin-bottom: 5px;
        }
        .stats-card .label {
            font-size: 14px;
            color: #999;
            margin-bottom: 10px;
        }
        .stats-card .change {
            font-size: 12px;
            font-weight: 500;
        }
        .stats-card .change.positive {
            color: #2ecc71;
        }
        .stats-card .change.negative {
            color: #e74c3c;
        }
        .table-container {
            background: white;
            border-radius: 12px;
            padding: 24px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }
        .table-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        .table-title {
            font-size: 18px;
            font-weight: 600;
            color: #1a202c;
        }
        .table-actions {
            display: flex;
            gap: 10px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            text-align: left;
            padding: 12px 16px;
            border-bottom: 1px solid #e0e0e0;
        }
        th {
            font-weight: 600;
            color: #666;
            font-size: 14px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        td {
            font-size: 14px;
            color: #333;
        }
        tr:hover {
            background: #f8f9fa;
        }
        .badge {
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 500;
        }
        .badge-primary {
            background: rgba(74, 108, 247, 0.1);
            color: #4a6cf7;
        }
        .badge-success {
            background: rgba(46, 204, 113, 0.1);
            color: #2ecc71;
        }
        .badge-warning {
            background: rgba(241, 196, 15, 0.1);
            color: #f1c40f;
        }
        .badge-danger {
            background: rgba(231, 76, 60, 0.1);
            color: #e74c3c;
        }
        .badge-secondary {
            background: rgba(149, 165, 166, 0.1);
            color: #95a5a6;
        }
        .form-group {
            margin-bottom: 20px;
        }
        .form-label {
            display: block;
            font-size: 14px;
            font-weight: 500;
            color: #333;
            margin-bottom: 8px;
        }
        .form-control {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
        }
        .form-control:focus {
            outline: none;
            border-color: #4a6cf7;
            box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
        }
        .form-select {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            font-size: 14px;
            background: white;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .form-select:focus {
            outline: none;
            border-color: #4a6cf7;
            box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
        }
        .form-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
        }
        .pagination {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            margin-top: 20px;
        }
        .pagination button {
            width: 36px;
            height: 36px;
            border: 1px solid #e0e0e0;
            background: white;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }
        .pagination button:hover:not(:disabled) {
            border-color: #4a6cf7;
            color: #4a6cf7;
        }
        .pagination button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        .pagination button.active {
            background: #4a6cf7;
            color: white;
            border-color: #4a6cf7;
        }
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }
        .modal.active {
            display: flex;
        }
        .modal-content {
            background: white;
            border-radius: 12px;
            padding: 24px;
            width: 90%;
            max-width: 600px;
            max-height: 90vh;
            overflow-y: auto;
            animation: modalFadeIn 0.3s ease;
        }
        @keyframes modalFadeIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #e0e0e0;
        }
        .modal-title {
            font-size: 20px;
            font-weight: 600;
            color: #1a202c;
        }
        .modal-close {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #999;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.3s ease;
        }
        .modal-close:hover {
            background: #f5f5f5;
            color: #333;
        }
        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 20px;
            padding-top: 15px;
            border-top: 1px solid #e0e0e0;
        }
        @media (max-width: 768px) {
            .content {
                margin-left: 0;
                padding: 15px;
            }
            .content.sidebar-closed {
                margin-left: 0;
            }
            .search-box input {
                width: 200px;
            }
            .grid {
                grid-template-columns: 1fr;
            }
            .table-container {
                overflow-x: auto;
            }
            table {
                min-width: 600px;
            }
        }
    </style>
</head>
<body>
    <div class="main-container">
        <!-- 侧边栏 -->
        <aside id="sidebar" class="sidebar">
            <!-- 侧边栏内容由sidebar.js动态生成 -->
        </aside>

        <!-- 主内容区 -->
        <main class="content" id="content">
            <!-- 头部 -->
            <header class="header">
                <h1>电商管理后台</h1>
                <div class="header-actions">
                    <div class="search-box">
                        <i class="icon-search">🔍</i>
                        <input type="text" placeholder="搜索...">
                    </div>
                    <div class="user-profile">
                        <div class="user-avatar">管</div>
                        <div class="user-info">
                            <span class="user-name">管理员</span>
                            <span class="user-role">系统管理员</span>
                        </div>
                    </div>
                </div>
            </header>

            <!-- 仪表盘内容 -->
            <section id="dashboard-view" class="view active">
                <!-- 统计卡片 -->
                <div class="grid">
                    <div class="stats-card">
                        <div class="icon primary">💰</div>
                        <div class="value">¥128,500</div>
                        <div class="label">今日销售额</div>
                        <div class="change positive">↗️ +12.5%</div>
                    </div>
                    <div class="stats-card">
                        <div class="icon success">📦</div>
                        <div class="value">2,356</div>
                        <div class="label">今日订单</div>
                        <div class="change positive">↗️ +8.3%</div>
                    </div>
                    <div class="stats-card">
                        <div class="icon warning">👥</div>
                        <div class="value">15,234</div>
                        <div class="label">活跃用户</div>
                        <div class="change positive">↗️ +5.2%</div>
                    </div>
                    <div class="stats-card">
                        <div class="icon danger">⚠️</div>
                        <div class="value">45</div>
                        <div class="label">待处理订单</div>
                        <div class="change negative">↘️ -2.1%</div>
                    </div>
                </div>

                <!-- 最近订单 -->
                <div class="table-container">
                    <div class="table-header">
                        <h3 class="table-title">最近订单</h3>
                        <a href="#" class="btn btn-secondary">查看全部</a>
                    </div>
                    <table id="recent-orders-table">
                        <thead>
                            <tr>
                                <th>订单号</th>
                                <th>客户</th>
                                <th>金额</th>
                                <th>状态</th>
                                <th>日期</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <!-- 表格内容由JavaScript动态生成 -->
                        </tbody>
                    </table>
                    <div class="pagination">
                        <button disabled>‹</button>
                        <button class="active">1</button>
                        <button>2</button>
                        <button>3</button>
                        <button>›</button>
                    </div>
                </div>
            </section>

            <!-- 商品目录管理 -->
            <section id="products-view" class="view">
                <div class="card-header">
                    <h2 class="card-title">商品目录管理</h2>
                    <button class="btn btn-primary" id="add-product-btn">
                        <i class="icon-plus">+</i> 添加商品
                    </button>
                </div>
                <div class="card">
                    <div class="form-row" style="margin-bottom: 20px;">
                        <div class="form-group">
                            <label class="form-label">商品名称</label>
                            <input type="text" class="form-control" placeholder="搜索商品名称">
                        </div>
                        <div class="form-group">
                            <label class="form-label">分类</label>
                            <select class="form-select">
                                <option value="">全部分类</option>
                                <option value="1">电子产品</option>
                                <option value="2">服装鞋帽</option>
                                <option value="3">食品饮料</option>
                                <option value="4">家居日用</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label class="form-label">状态</label>
                            <select class="form-select">
                                <option value="">全部状态</option>
                                <option value="1">上架</option>
                                <option value="2">下架</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label class="form-label">&nbsp;</label>
                            <button class="btn btn-secondary" style="width: 100%;">
                                <i class="icon-search">🔍</i> 搜索
                            </button>
                        </div>
                    </div>
                </div>
                <div class="table-container">
                    <table id="products-table">
                        <thead>
                            <tr>
                                <th>商品ID</th>
                                <th>商品名称</th>
                                <th>分类</th>
                                <th>价格</th>
                                <th>库存</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <!-- 表格内容由JavaScript动态生成 -->
                        </tbody>
                    </table>
                </div>
            </section>

            <!-- 订单处理流程 -->
            <section id="orders-view" class="view">
                <div class="card-header">
                    <h2 class="card-title">订单处理流程</h2>
                    <div class="table-actions">
                        <button class="btn btn-secondary">
                            <i class="icon-download">⬇️</i> 导出订单
                        </button>
                    </div>
                </div>
                <div class="table-container">
                    <table id="orders-table">
                        <thead>
                            <tr>
                                <th>订单号</th>
                                <th>客户</th>
                                <th>商品</th>
                                <th>金额</th>
                                <th>状态</th>
                                <th>日期</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <!-- 表格内容由JavaScript动态生成 -->
                        </tbody>
                    </table>
                </div>
            </section>

            <!-- 客户管理 -->
            <section id="customers-view" class="view">
                <div class="card-header">
                    <h2 class="card-title">客户管理</h2>
                    <button class="btn btn-secondary">
                        <i class="icon-download">⬇️</i> 导出客户
                    </button>
                </div>
                <div class="table-container">
                    <table id="customers-table">
                        <thead>
                            <tr>
                                <th>客户ID</th>
                                <th>姓名</th>
                                <th>邮箱</th>
                                <th>电话</th>
                                <th>注册日期</th>
                                <th>订单数</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <!-- 表格内容由JavaScript动态生成 -->
                        </tbody>
                    </table>
                </div>
            </section>

            <!-- 促销活动配置 -->
            <section id="promotions-view" class="view">
                <div class="card-header">
                    <h2 class="card-title">促销活动配置</h2>
                    <button class="btn btn-primary">
                        <i class="icon-plus">+</i> 创建活动
                    </button>
                </div>
                <div class="table-container">
                    <table id="promotions-table">
                        <thead>
                            <tr>
                                <th>活动ID</th>
                                <th>活动名称</th>
                                <th>类型</th>
                                <th>开始日期</th>
                                <th>结束日期</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <!-- 表格内容由JavaScript动态生成 -->
                        </tbody>
                    </table>
                </div>
            </section>

            <!-- 业务数据分析 -->
            <section id="analytics-view" class="view">
                <div class="grid">
                    <div class="card">
                        <h3 class="card-title">销售趋势</h3>
                        <div style="height: 300px; margin-top: 20px; background: #f8f9fa; border-radius: 8px;">
                            <!-- 图表占位 -->
                            <div style="height: 100%; display: flex; align-items: center; justify-content: center; color: #999;">📊 销售趋势图表</div>
                        </div>
                    </div>
                    <div class="card">
                        <h3 class="card-title">订单来源分析</h3>
                        <div style="height: 300px; margin-top: 20px; background: #f8f9fa; border-radius: 8px;">
                            <!-- 图表占位 -->
                            <div style="height: 100%; display: flex; align-items: center; justify-content: center; color: #999;">📈 订单来源饼图</div>
                        </div>
                    </div>
                </div>
                <div class="card">
                    <h3 class="card-title">热销商品排行</h3>
                    <div style="height: 400px; margin-top: 20px; background: #f8f9fa; border-radius: 8px;">
                        <!-- 图表占位 -->
                        <div style="height: 100%; display: flex; align-items: center; justify-content: center; color: #999;">🏆 热销商品排行榜</div>
                    </div>
                </div>
            </section>
            
            <!-- 库存管理页面 -->
            <section id="inventory-view" class="view">
                <div class="header">
                    <h1>库存管理</h1>
                    <div class="header-actions">
                        <div class="search-box">
                            <i class="icon icon-search">🔍</i>
                            <input type="text" placeholder="搜索商品..." id="inventory-search">
                        </div>
                        <button class="btn btn-secondary" id="export-inventory">
                            <i class="icon icon-download">⬇️</i>导出
                        </button>
                        <button class="btn btn-primary" id="refresh-inventory">
                            刷新
                        </button>
                    </div>
                </div>
                
                <div class="grid">
                    <div class="stats-card">
                        <div class="icon primary">📦</div>
                        <div class="value" id="total-inventory-items">0</div>
                        <div class="label">总库存商品</div>
                    </div>
                    <div class="stats-card">
                        <div class="icon warning">⚠️</div>
                        <div class="value" id="low-stock-items">0</div>
                        <div class="label">低库存商品</div>
                    </div>
                    <div class="stats-card">
                        <div class="icon danger">🚨</div>
                        <div class="value" id="out-of-stock-items">0</div>
                        <div class="label">缺货商品</div>
                    </div>
                    <div class="stats-card">
                        <div class="icon success">💰</div>
                        <div class="value" id="inventory-total-value">¥0</div>
                        <div class="label">库存总价值</div>
                    </div>
                </div>
                
                <div class="grid">
                    <div class="card">
                        <div class="card-header">
                            <h3 class="card-title">低库存警报</h3>
                        </div>
                        <div id="low-stock-alerts" class="alerts-list">
                            <!-- 低库存警报内容将通过JavaScript动态生成 -->
                        </div>
                    </div>
                    
                    <div class="card" style="grid-column: span 2;">
                        <div class="card-header">
                            <h3 class="card-title">库存筛选</h3>
                        </div>
                        <div class="form-row">
                            <div class="form-group">
                                <label class="form-label">分类</label>
                                <select id="inventory-category" class="form-select">
                                    <option value="">全部分类</option>
                                    <option value="电子产品">电子产品</option>
                                    <option value="服装">服装</option>
                                    <option value="食品">食品</option>
                                    <option value="家居">家居</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label class="form-label">库存状态</label>
                                <select id="inventory-status" class="form-select">
                                    <option value="all">全部状态</option>
                                    <option value="正常">正常</option>
                                    <option value="低库存">低库存</option>
                                    <option value="预警">预警</option>
                                    <option value="缺货">缺货</option>
                                </select>
                            </div>
                            <div class="form-group" style="display: flex; align-items: center;">
                                <input type="checkbox" id="low-stock-filter">
                                <label for="low-stock-filter" style="margin-left: 8px;">仅显示低库存</label>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="table-container">
                    <div class="table-header">
                        <h3 class="table-title">库存列表 (共 <span id="inventory-count">0</span> 条记录)</h3>
                    </div>
                    <table>
                        <thead>
                            <tr>
                                <th>商品名称</th>
                                <th>SKU</th>
                                <th>属性</th>
                                <th>当前库存</th>
                                <th>安全库存</th>
                                <th>单位成本</th>
                                <th>库位</th>
                                <th>最后更新</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="inventory-table-body">
                            <!-- 库存表格内容将通过JavaScript动态生成 -->
                        </tbody>
                    </table>
                    <div class="pagination" id="inventory-pagination">
                        <!-- 分页控件将通过JavaScript动态生成 -->
                    </div>
                </div>
            </section>
        </main>
    </div>

    <!-- 添加商品模态框 -->
    <div id="add-product-modal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">添加新商品</h3>
                <button class="modal-close" id="close-modal-btn">×</button>
            </div>
            <form id="add-product-form">
                <div class="form-row">
                    <div class="form-group">
                        <label class="form-label">商品名称</label>
                        <input type="text" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label">商品分类</label>
                        <select class="form-select" required>
                            <option value="">请选择分类</option>
                            <option value="1">电子产品</option>
                            <option value="2">服装鞋帽</option>
                            <option value="3">食品饮料</option>
                            <option value="4">家居日用</option>
                        </select>
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group">
                        <label class="form-label">商品价格</label>
                        <input type="number" class="form-control" step="0.01" min="0" required>
                    </div>
                    <div class="form-group">
                        <label class="form-label">库存数量</label>
                        <input type="number" class="form-control" min="0" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">商品描述</label>
                    <textarea class="form-control" rows="4" required></textarea>
                </div>
                <div class="form-group">
                    <label class="form-label">商品状态</label>
                    <select class="form-select" required>
                        <option value="1">上架</option>
                        <option value="2">下架</option>
                    </select>
                </div>
            </form>
            <div class="modal-footer">
                <button class="btn btn-secondary" id="cancel-add-product-btn">取消</button>
                <button class="btn btn-primary" id="confirm-add-product-btn">确定添加</button>
            </div>
        </div>
    </div>

    <script src="assets/js/app.js"></script>
     <script src="assets/js/sidebar.js"></script>
     <script src="assets/js/dashboard.js"></script>
     <script src="assets/js/products.js"></script>
     <script src="assets/js/orders.js"></script>
     <script src="assets/js/customers.js"></script>
     <script src="assets/js/promotions.js"></script>
     <script src="assets/js/analytics.js"></script>
     <script src="assets/js/inventory.js"></script>
</body>
</html>